home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
ShellPanel
/
Alert.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
1KB
|
45 lines
/* File: Alert.m - (Interactive) Unix shell version of NXRunAlertPanel
*
* By: Christopher Lane (lane@sumex-aim.stanford.edu)
*
* Date: 10 November 1992
*
* Copyright: 1990, 1991 & 1992 by The Leland Stanford Junior University.
* This program may be distributed without restriction for non-commercial use.
*/
#import <stdlib.h>
#import <appkit/Panel.h>
#import <appkit/Application.h>
// int NXRunAlertPanel(const char *title, const char *msg, const char *defaultButton,
// const char *alternateButton, const char *otherButton, ...)
typedef enum {TITLE, MESSAGE, DEFAULT, ALTERNATE, OTHER, ARGC} ARGUMENTS;
typedef enum {ALERTDEFAULT = EXIT_SUCCESS, ALERTALTERNATE, ALERTOTHER, ALERTERROR} RESULTS;
void main(int argc, char *argv[])
{
int result, context;
context = [(NXApp = [Application new]) activateSelf:YES];
result = NXRunAlertPanel(
(argc > TITLE) ? [NXApp appName] : NULL,
(argc > MESSAGE) ? argv[MESSAGE] : NULL,
(argc > DEFAULT) ? argv[DEFAULT] : NULL,
(argc > ALTERNATE) ? argv[ALTERNATE] : NULL,
(argc > OTHER) ? argv[OTHER] : NULL
);
if (context) (void) [NXApp activate:context];
[NXApp free];
switch (result) {
case NX_ALERTDEFAULT: exit(ALERTDEFAULT);
case NX_ALERTALTERNATE: exit(ALERTALTERNATE);
case NX_ALERTOTHER: exit(ALERTOTHER);
}
exit(ALERTERROR);
}